<?php require_once('Connections/bienestar.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_bienestar, $bienestar);
$query_Recordset1 = "SELECT * FROM mercado";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $bienestar) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!DOCTYPE html>
<html lang="es">
<head>
	<meta charset="utf-8"/>
	<title>www.bienesstaronline.com</title>
	<link rel="stylesheet" type="text/css" href="estilos.css">
	<script type="text/javascript"  href="./js/scripts.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
	background-image: url(/productos/fondo.gif);
}
</style>
</head>
<body>
	<header>
		<h1>Detalles</h1>
		<p><img src="imagenes/carrito-de-compras.gif" width="100" height="110"></p>
    </header>
	<section>
	<?php
		
		$re=mysql_query("SELECT * from mercado where id=" . (int) $_GET['id'])or die(mysql_error());
		if ($f=mysql_fetch_array($re)){	
		?>
		<center>
   	    	<img src="./productos/<?php echo $f['imagen'];?>"><br>
			<span><?php echo $f['nombre'];?></span></br>
            <span>Precio: <?php echo $f['valor'];?></span></br>
			<a href="./carritodecompras.php?id=<?php echo $f['id']; ?>">Añadir al Carrito de Compras</a>
		</center>	
	<?php
		}
	?>		
    	<center>
    	  <a href="/perfil.php">Volver a Listado de Productos</a>
    	</center>
</section>

</body>
</html>

